/**
 * 
 * If you have edited the file, please update
 * all the last-modified fields manually. Thanks!
 *
 * @last-modified by: 
 * @last-modified date: 
 * @last-modified time: 
 *
 * @author Swee Zhi
 * @date-created Sep 5, 2011    @time-created 8:19:45 PM
 *
 * @project: 
 * @module: 
 * @institution: 
 *
 */
package entity;

import util.enumeration.Country;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import util.enumeration.Gender;

@Entity(name="Tourist")
public class TouristEntity extends PersonEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    
//    @OneToMany(cascade={CascadeType.PERSIST})
//    private Collection<TravelInfoEntity> travelInfos;
    
    @OneToMany(cascade={CascadeType.PERSIST})
    private Collection<TripItineraryEntity> tripItineraries;
    
    @OneToOne(cascade={CascadeType.PERSIST})
    private PersonalPrefEntity personalPref;
    
    /** Creates a new instance of TouristEntity */
    public TouristEntity() {
        super();
    }
    
    public void create(String lastName, String firstName, 
                       Gender gender, Date birthdate, 
                       Country country, String locale,
                       String email, String emailSecondary) {
        super.setLastName(lastName);
        super.setFirstName(firstName);
        super.setGender(gender);
        super.setBirthdate(birthdate);
        super.setCountry(country);
        super.setLocale(locale);
        super.setEmail(email);
        super.setEmailSecondary(emailSecondary);
    }
    
    public void update(Country country, String locale, String emailSecondary) {
        super.setCountry(country);
        super.setLocale(locale);
        super.setEmailSecondary(emailSecondary);
    }

    public PersonalPrefEntity getPersonalPref() {
        return personalPref;
    }

    public void setPersonalPref(PersonalPrefEntity personalPref) {
        this.personalPref = personalPref;
    }

    public Collection<TripItineraryEntity> getTripItineraries() {
        return tripItineraries;
    }

    public void setTripItineraries(Collection<TripItineraryEntity> tripItineraries) {
        this.tripItineraries = tripItineraries;
    }
}
